using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.HomeServer.Controls;

namespace WhsFacebook.Whs.WhsAddin.SettingsControls
{
    public partial class Ready : SettingsControlBase
    {
        public Ready(WhsFacebookSettingsTab tab)
            : base(tab)
        {
            if (_log.IsDebugEnabled)
                _log.Debug("Initialization start");

            try
            {
                InitializeComponent();

                // done
                if (_log.IsDebugEnabled)
                    _log.Debug("Initialization done");
            }
            catch (Exception e)
            {
                _log.Fatal("Failed to initialize", e);

                throw;
            }
        }

        private void openSharePointWebLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
        }

        private void SharePointReady_Load(object sender, EventArgs e)
        {
            if (_log.IsDebugEnabled)
                _log.Debug("Loading start");

            try
            {

                // done
                if (_log.IsDebugEnabled)
                    _log.Debug("Loading done");
            }
            catch (Exception x)
            {
                _log.Fatal("Failed to load", x);

                throw;
            }
        }

        private void fbAppLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                _tab.Services.OpenUrl(string.Format(
                    Whs.Properties.Constants.FacebookAppUrlEx,
                    WhsFacebookRegistry.GetInstanceId()
                    ));
            }
            catch (Exception x)
            {
                QMessageBox.Show(
                    x.Message,
                    Properties.Resources.txtOpenFacebookFailedTitle,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                
                throw;
            }
        }

    }
}
